import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;
import org.w3c.dom.ls.LSOutput;

/**
 * @program: 12.1
 * @description:
 * @author: 李鑫月
 * @create: 2021-12-01 16:16
 **/
class MyException extends Exception{
    public MyException(String mes){
        super(mes);
    }
}
class MyException2 extends RuntimeException{

}
public class Demo01 {
    public static void func(int x){
        try {
            if(x==0){
            throw new MyException("lxy");
            }
        }catch (MyException e){
            e.printStackTrace();
        }
    }

    public static void func2(int x)throws MyException{
        if(x==0){
            throw new MyException("aaa");
        }
    }

    public static void main(String[] args) throws MyException {
        func(0);
        func2(0);
    }



    public static void main1(String[] args) {
        int[]  arr={1,2,3};
        try{
            System.out.println(arr[5]);
        }catch (IndexOutOfBoundsException e){
//            e.printStackTrace();

            System.out.println("数组越界异常");
        }
        System.out.println("hhhh");
    }
}
